<%@ 
page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<%@page import="com.lovo.bbs.vo.*,java.util.*"%>

<%
	String cond = (String) request.getAttribute("cond");//搜索类型
	String forumid = (String)request.getAttribute("fid");//搜索指定论坛信息
	if(forumid==null){
			forumid="1";
	}
	
	ArrayList<TopicVo> resultList = (ArrayList<TopicVo>) request
			.getAttribute("resultList");//搜索结果集
	int resultCount = (Integer) request.getAttribute("resultCount");//搜索结果数

	ForumStatVo forumInfo = (ForumStatVo) request
			.getAttribute("forumInfo");//网站杂项信息

	String searchname = "";
	if (cond.equals("best")) {
		searchname = "精华";
	} else if (cond.equals("top")) {
		searchname = "置顶";
	} else if (cond.equals("today")) {
		searchname = "今日";
	} else if (cond.equals("thisweek")) {
		searchname = "本周";
	} else if(cond.equals("localbest")){
	    searchname = "本版精华";
	}else if(cond.equals("localhot")){
	   searchname =  "本版热贴";
	}

	Iterator<TopicVo> it;

	LoginVo loginvo = (LoginVo) session.getAttribute("loginvo");
%>


<html>
	<head>
		<title><%=forumInfo.getSiteName()%></title>
		<link href="css/style.css" type="text/css" rel=stylesheet />
		<link href="css/menu.css" type="text/css" rel=stylesheet />
		<link href="css/common.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="js/vbulletin_global.js"></script>
		<script type="text/javascript" src="js/vbulletin_menu.js"></script>
		<script type="text/javascript" src="js/wbs_common.js"></script>
		<script type="text/javascript" src="js/wbs_ajax.js"></script>
		<script type="text/javascript" src="js/wbs_popup.js"></script>
	</head>




	<body>
		<div id="overlay"></div>
		<div id=popLayer style="position: absolute; z-index: 101"
			class=cPopText></div>
		<table width="100%" align="center" cellpadding="0" cellspacing="1"
			class="CommonNavigation_OuterTableCSS">
			<tr>
				<td>
					<table width="100%" cellpadding="9" cellspacing="0">
						<tr>
							<td class="CommonNavigation_InnerTableFooterCSS">
								<table width="100%" cellpadding="0" cellspacing="0" board="1">
									<tr>


										<!--登录状态----------------------------------------------------------------->
										<td class="SmallTxt">
											<%
												if (session.getAttribute("loginvo") == null) {
											%>
											<font class="SmallGrayText">欢迎: <b>游客</b> </font>
											<font class="SmlLinks">( </font><a href="javascript:void(0)"
												onclick="openLogin()">登陆</a><font class="SmlLinks"> |
											</font><a href="javascript:void(0)" onclick="openRegister()">注册</a><font
												class="SmlLinks"> )</font>


											<!--注册窗口----------------------------------------------------------------->
											<%@include file="include/regWindow.html"%>

											<%
												} else {
													loginvo = (LoginVo) session.getAttribute("loginvo");
											%>
											欢迎:
											<em id="logedusername" value="<%=loginvo.getUserName()%>">
												<a href="userinfo.jsp?username=<%=loginvo.getUserName()%>"><%=loginvo.getUserName()%></a>
											</em>
											<font class="SmlLinks">( </font><a href="javascript:void(0)"
												onclick="logout()">退出</a><font class="SmlLinks"><font
												class="SmlLinks"> )</font>&nbsp;&nbsp; <a
												class="FunctionDesk" href="control/control.jsp?username=<%=loginvo.getUserName()%>">控制面板</a> <%
 	}
 %> </font>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<font size="1"><br> </font>
		<font size="1"><br> </font>







		<!--导航 ----------------------------------------------------------------->
		<table width="100%" cellpadding="0" cellspacing="1"
			class="BreadCrumb_OuterTableCSS">
			<tr>
				<td>
					<table width="100%" cellpadding="9" cellspacing="0"
						class="BreadCrumb_InnerTableCSS">
						<tr>
							<td>
								<a title="返回首页" class="SmlBoldLinks" href="index.jsp"><%=forumInfo.getSiteName()%></a>
								<font class="BreadCrumb_NavSeperator">&#187;</font>
								
						<%
						    if(cond.equals("localbest")||cond.equals("localhot")){
						%>		
							<a title="返回论坛" class="SmlBoldLinks" href="forum.jsp?fid=<%=forumid%>">返回论坛</a>
							<font class="BreadCrumb_NavSeperator">&#187;</font>
						<%} %>
						
								<a>搜索<%=searchname%>主题</a>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<font size="1"><br> </font>
		<font size="1"><br> </font>



		<!--搜索结果 ----------------------------------------------------------------->
		<table class="forum_out" width="100%" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td>
					<table border="0" width="100%" cellpadding="5" cellspacing="0">
						<tr>
							<td Class="board" colspan="6" align="center">
								搜索结果:
								<%=resultCount%>个<%=searchname%>主题
							</td>
						</tr>
						<tr>
							<td class="forumcell_read" style="width: 5%">
								&nbsp;
							</td>
							<td class="forumcell_read" style="width: 40%">
								主题
							</td>
							<td class="forumcell_read" nowrap="nowrap" align="center">
								所属论坛
							</td>
							<td class="forumcell_read" align="center">
								回复数
							</td>
							<td class="forumcell_read" align="center">
								查看数
							</td>
							<td class="forumcell_read" align="center">
								最后回复
							</td>
						</tr>
						<%
							if (resultList == null) {
								resultList = new ArrayList<TopicVo>();
							}
							it = resultList.iterator();
							if (it != null) {
								while (it.hasNext()) {
									TopicVo data = it.next();
						%>
						<tr>
							<td class="topiccell_button" align="center" style="width: 5%;">
								<img title="" align="absmiddle" align="center"
									src="images/ico/Topic_Open.gif" border="0" />
							</td>
							<td class="topiccell_button" valign="middle" style="width: 40%;">
								<a class="SmlLinks" href="topic.jsp?tid=<%=data.getTopicid()%>"><%=data.getTopicTitle()%></a>
							</td>
							<td class="topiccell_button" align="center" style="width: 15%;">
								<a class="SmlLinks" href="forum.jsp?fid=<%=data.getForumid()%>"><%=data.getForumName()%></a>
							</td>
							<td class="topiccell_button" align="center" style="width: 7%;">
								<font class="SmallTxt"><%=data.getPostNum()%> </font>
							</td>
							<td class="topiccell_button" align="center" style="width: 7%;">
								<font class="SmallTxt"><%=data.getHits()%> </font>
							</td>
							<td class="topiccell_button" align="center" style="width: 22%;">
								<font class="SmallTxt">由: <%=data.getLastPostAuthor()%> <br>
									于 <%=data.getLastPostDate()%> 最后回复</font>
							</td>
						</tr>
						<%
							}
							}
						%>
					</table>
				</td>
			</tr>
		</table>
		<font size="1"><br> </font>
		<font size="1"><br> </font>
		<font size="1"><br> </font>



		<!--页脚 ----------------------------------------------------------------->
		<%@include file="include/copyright.html"%>



		<!--登录窗口 ----------------------------------------------------------------->
		<%@include file="include/loginWindow.html"%>

	</body>
</html>
